import { routes, RouteState } from './routes'
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'

const renderView = (routes: RouteState[] ) => {
	return routes && routes.map((v, i) => {
		return <Route key={i} path={ v.path } element={ <v.element></v.element> }>
			{ v.children && renderView(v.children) }
		</Route>
	})
}

const Index = () => {
	return (
		<Router>
			<Routes>
				{ renderView(routes) }
			</Routes>
		</Router>
	)
}


export default Index